/*
 * Copyright (c) 2021, Texas Instruments Incorporated
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 *
 * *  Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 *
 * *  Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 *
 * *  Neither the name of Texas Instruments Incorporated nor the names of
 *    its contributors may be used to endorse or promote products derived
 *    from this software without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
 * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */

#include "ti_msp_dl_config.h"
#include "board.h"
// #include "oled.h"
// #include "bmp.h"
// #include "led.h"
#include "lcd_init.h"
#include "lcd.h"
#include "pic.h"

volatile unsigned int delay_times = 0;

void SysTick_Handler(void)
{
        if( delay_times != 0 )
        {
                delay_times--;
        }
}

int main(void)
{
	delay_times = 100000;
    SYSCFG_DL_init();

    // 串口输出测试
    lc_printf("Hello %s\r\n","World");

    // 日志输出测试
    LOG_D("Log Debug Test....%s", "LCKFB");

	u8 t=' ';

	LCD_Init();//LCD初始化
	LCD_Fill(0,0,LCD_W,LCD_H,BLUE);
	// LED=0;
	LCD_ShowString(18,30,"LuatOS",WHITE,BLUE,32,0);
	// OLED_Init();
	// OLED_ColorTurn(0);//0正常显示，1 反色显示
    // OLED_DisplayTurn(0);//0正常显示 1 屏幕翻转显示
	while(1)
	{
	// 	OLED_ShowPicture(0,0,128,64,BMP1,1);
	// 	OLED_Refresh();
	// 	delay_ms(500);
	// 	OLED_Clear();
	// 	OLED_ShowChinese(0,0,0,16,1);//中
	// 	OLED_ShowChinese(18,0,1,16,1);//景
	// 	OLED_ShowChinese(36,0,2,16,1);//园
	// 	OLED_ShowChinese(54,0,3,16,1);//电
	// 	OLED_ShowChinese(72,0,4,16,1);//子
	// 	OLED_ShowChinese(90,0,5,16,1);//技
	// 	OLED_ShowChinese(108,0,6,16,1);//术
	// 	OLED_ShowString(8,16,"ZHONGJINGYUAN",16,1);
	// 	OLED_ShowString(20,32,"2014/05/01",16,1);
	// 	OLED_ShowString(0,48,"ASCII:",16,1);  
	// 	OLED_ShowString(63,48,"CODE:",16,1);
	// 	OLED_ShowChar(48,48,t,16,1);//显示ASCII字符	   
	// 	t++;
	// 	if(t>'~')t=' ';
	// 	OLED_ShowNum(103,48,t,3,16,1);
	// 	OLED_Refresh();
	// 	delay_ms(500);
	// 	OLED_Clear();
	// 	OLED_ShowChinese(0,0,0,16,1);  //16*16 中
	//     OLED_ShowChinese(16,0,0,24,1); //24*24 中
	// 	OLED_ShowChinese(24,20,0,32,1);//32*32 中
	//     OLED_ShowChinese(64,0,0,64,1); //64*64 中
	// 	OLED_Refresh();
	//     delay_ms(500);
    //     OLED_Clear();
	// 	OLED_ShowString(0,0,"ABC",8,1);//6*8 “ABC”
	// 	OLED_ShowString(0,8,"ABC",12,1);//6*12 “ABC”
	//     OLED_ShowString(0,20,"ABC",16,1);//8*16 “ABC”
	// 	OLED_ShowString(0,36,"ABC",24,1);//12*24 “ABC”
	//     OLED_Refresh();
	// 	delay_ms(500);
	// 	OLED_ScrollDisplay(11,4,1);
	}
}
